<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="../template.xhtml" 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	
	<ui:define name="conteudo">		
		<a4j:keepAlive beanName="varaBean"/>
	
		<div style="width: 700px">
			<div style="float:left">
				<h2 style="margin: 0px"><h:outputText value="#{msg['vara.titulo']}"/></h2>
			</div>
			<div style="float:right">
				<h:commandButton value="#{msg['geral.cadastrar']}" action="#{varaBean.cadastrarVara}" />
			</div>
		</div>
		
		<div style="height: 50px"></div>
		
		<rich:dataTable var="vara" value="#{varaBean.varas}" width="700px">
			<rich:column>
				<f:facet name="header">
					<h:outputText value="#{msg['geral.nome']}" />
				</f:facet>
				<h:outputText value="#{vara.nome}" />
			</rich:column>

			<rich:column width="80px">
				<h:commandLink action="#{varaBean.editarVara}">
                    <h:outputText value="#{msg['geral.editar']}" />
                    <f:setPropertyActionListener value="#{vara}" target="#{varaBean.vara}" />
                </h:commandLink>
				<h:outputText value=" | " />
				<h:commandLink action="#{varaBean.removerVara}">
                    <h:outputText value="#{msg['geral.remover']}" />
                    <f:setPropertyActionListener value="#{vara}" target="#{varaBean.vara}" />
                </h:commandLink>
			</rich:column>
		</rich:dataTable>
	</ui:define>
</ui:composition>